<%-- 
    Document   : listdatban
    Created on : Nov 27, 2011, 9:28:16 PM
    Author     : Venus
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">
<%@page import="java.util.*,Beans.ThamSoHT,Models.ThamSoHT_Model, Models.DatBan_Model"%>
<!--
Danh sách các tham số hệ thống ở trang này :
order      areainfo     areamsg     status      arealang
newarea    areaname     save        action      arealist
enable     disable      search
-->
<script type="text/javascript">
    function keypress(e){
        //Hàm dùng để ngăn người dùng nhập các ký tự khác ký tự số vào TextBox
        var keypressed = null;
        if (window.event)
        {
            keypressed = window.event.keyCode; //IE
        }
        else
        {
            keypressed = e.which; //NON-IE, Standard
        }
        if (keypressed < 48 || keypressed > 57 )
        { //CharCode của 0 là 48 (Theo bảng mã ASCII)
            //CharCode của 9 là 57 (Theo bảng mã ASCII)
            if (keypressed == 8 || keypressed == 127  )
            {//Phím Delete và Phím Back
                return;
            }
            return false;
        }
    }
</script>
<%
            int langid = (Integer) session.getAttribute("langid"); // ngôn ngữ hiện tại
            String dsts = " 'datemsg', 'to', 'timehistory', 'phonenumber', 'reservlist', 'rightmsg', 'tablename', 'areaname', 'customer', 'delete', 'from', 'hours', 'notice', 'numberofcustomer' ";
            ThamSoHT[] mdsts = ThamSoHT_Model.DSThamSo(dsts, langid); // mảng chứa các tham số của trang này.


            String areaname = mdsts[0].getTenTS();
            String customer = mdsts[1].getTenTS();
            String datemsg = mdsts[2].getTenTS();
            String delete = mdsts[3].getTenTS();
            String from = mdsts[4].getTenTS();
            String hours = mdsts[5].getTenTS();
            String notice = mdsts[6].getTenTS();
            String numberofcustomer = mdsts[7].getTenTS();
            String phonenumber = mdsts[8].getTenTS();
            String reservlist = mdsts[9].getTenTS();
            String rightmsg = mdsts[10].getTenTS();
            String tablename = mdsts[11].getTenTS();
            String timehistory = mdsts[12].getTenTS();
            String to = mdsts[13].getTenTS();

            String msgright = notice + "/" + rightmsg;
            String msgdate = notice + "/" + datemsg;                    
            
            Vector vDSDB = (Vector) request.getAttribute("DB");         
            int total = 0;
%>
<script type="text/javascript">
    $(function(){        
        $('#datepicker2').datepicker($.datepicker.regional['vi']);
        $( "#datepicker2" ).datepicker( "option", "dateFormat","dd/mm/yy");
        $('#datepicker3').datepicker($.datepicker.regional['vi']);
        $( "#datepicker3" ).datepicker( "option", "dateFormat","dd/mm/yy");
     });
</script>

    <div class="title">
        <%=reservlist%>
    </div>
    <div class="content">
        <form name="dsdb" action="">
            <table>
                <thead>
                    <tr>
                        <th style="width: 7%;" class="STT">
                            <input type="checkbox" onclick="CheckAllDB()">
                        </th>
                        <th style="width: 21%;">
                            <a href="#" id="titledskv1" style="margin-top: 5px;" class="down" lang="<%=msgright%>"  name="1" onclick="SortNgayGioDB(this.className, this.name, this.lang)">
                                <div style="float:left"><%=timehistory%></div>
                                <div style=" margin-right: 75px;" id="sortkv1" class="down1"></div>
                            </a>
                        </th>
                        <th style="width: 14%;">
                            <a href="#" id="titledskv2" style="margin-top: 5px;" class="down" lang="<%=msgright%>" name="1" onclick="SortKVDB( this.className, this.name, this.lang)">
                                <div style="float:left"><%=areaname%></div>
                                <div style=" margin-right: 25px;" id="sortkv2" class="down1"></div>
                            </a>
                        </th>
                        <th style="width: 11%;">
                            <a href="#" id="titledskv3" style="margin-top: 5px;" class="down" lang="<%=msgright%>"  name="1" onclick="SortTenBanDB( this.className, this.name, this.lang)">
                                <div style="float:left"><%=tablename%></div>
                                <div style=" margin-right: 25px;" id="sortkv3" class="down1"></div>
                            </a>
                        </th>
                        <th style="width: 15%;">
                            <a href="#" id="titledskv4" style="margin-top: 5px;" class="down" lang="<%=msgright%>"  name="1" onclick="SortKHDB( this.className, this.name, this.lang)">
                                <div style="float:left"><%=customer%></div>
                                <div style=" margin-right: 30px;" id="sortkv4" class="down1"></div>
                            </a>
                        </th>
                        <th style="width: 14%;">
                            <a href="#" id="titledskv5" style="margin-top: 5px;" class="down" lang="<%=msgright%>"  name="1" onclick="SortDTDB( this.className, this.name, this.lang)">
                                <div style="float:left"><%=phonenumber%></div>
                                <div style=" margin-right: 20px;" id="sortkv5" class="down1"></div>
                            </a>
                        </th>
                        <th style="">
                            <a href="#" id="titledskv6" class="down" lang="<%=msgright%>"  name="1" onclick="SortSoKhachDB( this.className, this.name, this.lang)">
                                <div><%=numberofcustomer%></div>
                                <div >
                                    <div id="sortkv6" class="down2"></div>
                                    <div id="sortkv6" class="up2" style="display:none;"></div>
                                </div>
                            </a>
                        </th>
                        <th></th>
                    </tr>
                    <tr id="searchDB">
                        <td><img onclick="SearchDB(this.alt, this.lang, this.id)" id="<%=msgdate%>" style=" margin-top: 10px; margin-bottom: -20px;" class="searchKV" alt="1" lang="<%=msgright%>" src="images/search1.png"></td>
                        <td>
                            <div style=" width: 35px; float: left;"><%=from%></div>
                            <input type="textbox" maxlength="10"  class="text tungay" style=" width: 80px; margin-right: 5px; margin-bottom: 5px;" id="datepicker2">
                            <input type="textbox" class="text tugio" style=" width: 30px;  margin-right: 2px;  margin-bottom: 5px;" maxlength="2" onkeypress="return keypress(event)" value="0"><%=hours%>
                            <br />
                            <div style=" width: 35px; float: left;"><%=to%></div>
                            <input type="textbox" maxlength="10" class="text denngay" style=" width: 80px; margin-right: 5px; margin-bottom: 5px; " id="datepicker3">
                            <input type="textbox" class="text dengio" style=" width: 30px;  margin-right: 2px; margin-bottom: 5px;" maxlength="2" onkeypress="return keypress(event)" value="0"><%=hours%>
                        </td>
                        <td>
                            <input type="textbox" style=" width: 100px;"  class="tenkv text">
                        </td>
                        <td>
                            <input type="textbox" style=" width: 55px;"  class="tenban text" onkeypress="return keypress(event)">
                        </td>
                        <td>
                            <input type="textbox" style=" width: 100px;"  class="kh text">
                        </td>
                        <td><input type="textbox" style=" width: 85px;"  class="sodt text" onkeypress="return keypress(event)"></td>
                        <td>
                            <input type="textbox" style=" width: 85px;"  class="sokhach text" onkeypress="return keypress(event)">
                        </td>
                        <td></td>
                    </tr>
                </thead>
                <tbody>
                    <%
                                for (int i = 0; i  < vDSDB.size(); i++) {
                                    Beans.DatBan db = (Beans.DatBan) vDSDB.elementAt(i);
                    %>
                    <tr>
                        <%
                                                                    if (vDSDB.size() > 1) {%>
                        <td class="STT"><input type="checkbox" value="<%= db.getMaDB()%>" name="optionDB"></td>
                            <%  } else {%>
                        <td class="STT"><input type="checkbox" value="<%= db.getMaDB()%>" class="optionDB" ></td>
                            <%  }
                            %>

                        <td ><%= db.getNgay()%>  -  <%= db.getGio()%>   <%=hours%></td>
                        <td ><%=DatBan_Model.LayTenKV(db.getMaBan(), langid)%></td>
                        <td ><%=DatBan_Model.LayTenBan(db.getMaBan())%></td>
                        <td><%=db.getKhachHang()%></td>
                        <td><%=db.getSoDT()%></td>
                        <td><%=db.getSoKhach()%></td>
                        <td><a href="#" name="<%=msgright%>" id="<%=db.getMaDB() %>" lang="<%=db.getMaBan() %>" onclick="DetailDB(this.name, this.id, this.lang)"><img style="width: 17px; margin-top: 2px;" alt="" src="images/edit.png"></a></td>
                    </tr>
                    <%  }
                    %>
                </tbody>
            </table>
            <div style="float:left;">
                    <%
                        if(vDSDB.size() > 1){%>
                        <input type="button" style="margin-left: 0; margin-top: 5px; margin-bottom: 5px;" class="button" value ="<%=delete %>" alt="2" lang="<%=msgright%>" id="1"  onclick="DeleteDB( this.alt, this.id, this.lang)">
                    <%  }
                        else{%>
                        <input type="button" style="margin-left: 0; margin-top: 5px; margin-bottom: 5px;" class="button" value ="<%=delete %>" alt="1" lang="<%=msgright%>" id="1"  onclick="DeleteDB( this.alt, this.id, this.lang)">
                    <%  }
                    %>
            </div>
        </form>
    </div>

